package com.dqp.cslggroup.SubjectView;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import com.dqp.cslggroup.SubjectView.SubjectFragment;
import com.dqp.cslggroup.SubjectView.SubjectFragmentLazyLoad;

import java.util.ArrayList;
import java.util.List;

public class SubjectViewPagerAdapter extends FragmentStatePagerAdapter {
    private final List<Fragment> mFragments = new ArrayList<>();

    public SubjectViewPagerAdapter(FragmentManager fm, int week) {
        super(fm,week);
        for (int i=0;i<20;i++){
            if (i!=week)
                mFragments.add(i,new SubjectFragmentLazyLoad());
            else  mFragments.add(i, new SubjectFragment());
        }
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {

    }
}
